Relocation
This section is new as of Version 1.2 of the Conformance
Guide, but will not be marked with diffmarks. The MIPS
processor specific ABI specifies a Global Offset Table (GOT)
which limits a DSO to 16K external references. This has
proven to be a limitation for a number of developers who
wish to create very large DSOs. A future version of the
processor specific ABI expands the GOT. This expanded GOT
is sufficiently desirable to incorporate it into Version 1.2
of this document.
The expanded GOT is defined by four new Relocation Types
which are added to
<elf.h>;
.
Figure 1. Expanded GOT Relocation Types
Name Value Field Symbol Calculation
______________________________________________________________________
R_MIPS_GOTHI16 | 22 | T-hi16 | external | (G - (short)G) >> 16 + A
________________|_______|________|__________|_________________________
R_MIPS_GOTLO16 | 23 | T-lo16 | external | G & 0xffff
________________|_______|________|__________|_________________________
R_MIPS_CALLHI16 | 30 | T-hi16 | external | (G - (short)G) >> 16 + A
________________|_______|________|__________|_________________________
R_MIPS_CALLLO16 | 31 | T-lo16 | external | G & 0xffff
________________|_______|________|__________|_________________________
The following paragraph replaces the third from last
paragraph of Chapter 4 of the MIPS processor specific ABI.
The first instance of R_MIPS_GOT16
or R_MIPS_GOTHI16
and R_MIPS_GOTLO16
or R_MIPS_CALL16
or R_MIPS_CALLHI16
and R_MIPS_CALLLO16
relocations cause the
link editor to build a global offset table if one has not already been built.
The following paragraph replaces the last paragraph of
Chapter 4 of the processor specific ABI.
R_MIPS_CALL16
or R_MIPS_CALLHI16
and R_MIPS_CALLLO16
relocation entries load
function addresses from the global offset table and indicate
that the dynamic linker can perform lazy binding. See "Global Offset Table"
in Chapter 5 of the processor specific ABI.
To allow vendors flexibility in defining new relocation
types for their own internal purposes, the following two
definitions are added to
#define R_MIPS_LOVENDOR 100 /* Vendor specific relocations */
#define R_MIPS_HIVENDOR 127
Vendors are free to use any value between 100 and 127 for
such internal purposes. Values in this ranges will not be
used for ABI purposes in the future.
Link Editing
ISVs are cautioned that products that compile and link edit
themselves after installation, or are designed to be on-site
linked with end-user developed code, may inadvertently use
system interfaces that are not defined by the ABI.
Specifically, the headers and static libraries on the
Reference Platform, not specified by the ABI, may not be
compatible with those headers and libraries on all ABI
vendors' platforms.
This problem occurs only when an ISV's application is link
edited after installation (i.e., uses the
ld command to build itself). If all executables and shared
libraries are built on the Reference Platform and pass the
Application Compliance Testing tool (ACT), the only possible
external interfaces are those specified by the ABI. (Note
that ACT does not test manifest constants, such as ioctl
calls compiled into the program.) The ABI interfaces are
present on all ABI conforming Operating Systems in the form
of dynamic shared libraries. Thus they will be resolved
through dynamic linking to the dynamic shared libraries at
run-time.
In the case where an application link edits itself after
installation, it may expose an incompatibility between non-
ABI headers or libraries on the Reference Platform and
another vendor's platform. Furthermore, vendors may change
the interface or implementation of libraries not covered by
the ABI in new operating system releases.
The MIPS ABI Group offers the following guidelines to ISV's
whose applications must link edit after installation; they
are not meant to be either exhaustive or foolproof:
- Compiler and linker flags are known to differ across
the various platforms. To aid the ISV, each vendor has
agreed to provide a consistent interface in the
wrappers
abicc
and abild
,
which are defined further in in this chapter.
- The math routines in
libm.a
will be consistent across all vendor's
platforms.
-
libcurses.a
is known to depend on private interfaces
in
libc.so.1
and should be avoided if possible, but
limited functionality may be used from it if care is
taken.
- Implementations of
libucb.a
may not be compatible across all vendor's
platforms and should not be used.
- ISV's should document the version of any system
interface used by their application that is not
supported by the ABI. For example, applications using
X widgets, X extensions, Motif or other system
libraries which must be linked statically should
document the release level of these libraries. This
will allow customers to compare release levels between
the application and their system.
- Not all compilation systems behave the same with
respect to conflicts with the ANSI C Strict Ref/Def
Initialization model (see section 3.1 of the ANSI C
Standard and elaboration in 3.1.2.2 of the Rationale
for ANSI C; and note that section numbering is
different in the ISO version). Some platforms emit
warnings from the loader, while others a fatal error.
If code is generated on a platform of the former type,
it may link on that platform but not on some others.
Application source code should be modified such that
each external data symbol is defined in exactly one
place, done by omitting the
extern
keyword. All other
references should use the extern
keyword.
Object Files
All
.o
files shipped with an ISV product must use position
independent code, as described in chapter 3 of the System V
ABI, MIPS Processor Supplement.
Debugging
Only an ELF symbol table is needed for assembly level
debugging with symbols.
Compiler and Linker Options
The various platforms use different flags and switches for
the compiler and linker. This is a reflection of the
differences in the heritage of the compiler systems on the
various machines. Platform vendors should support either the
standard SVR4 Software Generation System (SGS) flags and
switches or provide a wrapper function which translates
these standard switches into the local equivalents. The
wrappers
abicc
and
abild
have been developed to permit uniform compilation and
loader flags. Vendors should provide these wrappers or
equivalent functions. Some compilation systems may not
support all the flags and switches that the SVR4 SGS does.
Where possible the unsupported switches should be silently
ignored by the wrapper or the base compilation system.
The
abicc
wrapper supports the following flags, many are
described in more detail in the
cc(SD_CMD) page in the
- -A controls
#assert
mechanisms.
- -B symbolic, -Bsymbolic, -B dynamic, -Bdynamic, -B static,
-Bstatic controls linking phase library name lookup.
- -C controls comment removal.
- -c suppresses linking phase.
- -D controls
#define
mechanisms.
- -dn, -d n, -dy, -d y selects dynamic (y) or static
(n) linking.
- -E preprocess only (no compilation or linking).
- -f obsolete, ignored.
- -G direct linker to produce shared object.
- -g generate symbolic debug information.
- -H prints include file names as they are processed.
- -I controls include file lookup.
- -Jsfm not supported, silently ignored.
- -Kfpe, -K fpe, -Kmau, -K mau, -Ksd, -K sd, -Ksz, -K sz not supported,
silently ignored.
- -KPIC, -K PIC generate Position Independent Code (this is the default
for the MIPS ABI).
- -Kminabi, -K minabi restrict libraries to ABI definitions (not needed
for MIPS ABI, ignored).
- -Kxgot, -K xgot generate code to use an expanded Global Offset
Table (GOT).
- -L controls library search path at linking phase.
- -l search specified library.
- -o names output file.
- -O controls optimization.
- -P perform only preprocessing.
- -p generate profiling code.
- -Qn, -Q n, -Qy, -Q y generates compiler identification in output.
- -q controls generation of profiling code.
- -S suppress assembly and linking (leaves assembler file).
- -U causes specified name to be undefined.
- -V prints version information.
- -W not supported, generates a warning message.
- -Xa, -X a, -Xc, -X c, -Xt, -X t controls conformance
to ANSI and ISO C standards.
- -Xreadwrite const, -X readwrite const place const data
in writable memory. Selecting this option is a
violation of the ANSI C standard.
- -Xreadonly const, -X readonly const place const data
in read-only memory. This is the default.
- -Y not supported, generates a warning message.
The
abild
wrapper supports the following flags, some of which
are described in the
ld(SD_CMD)
page in the System V Interface Definition,
Third Edition (SVID 3).
- -a undefined references generate errors (static mode).
- -b controls DSO linkage.
- -dn, -d n, -dy, -d y selects dynamic (y) or static (n)
linking.
- -e defines entry point.
- -h controls dynamic linking name lookup.
- -l search the specified library.
- -m produce a memory map.
- -o names the output file.
- -r combine object files.
- -s strip symbolic information.
- -t suppress warning about multiple defined symbols of
different sizes.
- -u enters named symbol as an undefined.
- -zdefs, -z defs, -znodefs, -z nodefs, -ztext, -z text
controls handling of undefined symbols.
- -Bsymbolic, -B symbolic, -Bdynamic, -B dynamic,
-Bstatic, -B static control lib. name lookup
- -G produce shared object.
- -I specifies an interpreter to be linked with a.out.
- -L controls library lookup path.
- -M use specified map file.
- -Qn, -Q n, -Qy, -Q y add compiler identification
strings to output.
- -V output a version identifier string.
- -Y controls library search list.
Go to Next Chapter (Chapter 5)
Go back to the Overview
Back to the Table of Contents
Back to the MIPS ABI Home Page
Maintained by webmaster@mipsabi.org
last modified on 96/01/22
Copyright © 1995, MIPS ABI Group, Incorporated.